{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d6e5e4c9",
   "metadata": {},
   "source": [
    "## 上周回顾\n",
    "> * list 方法/函数 的所有使用场景及案例，方法如：\n",
    ">> 1. append()列表新增元素\n",
    ">> 2. pop(index)\\remove(values)\n",
    ">> 3. count()查询所有数量\n",
    ">> 4. index()\n",
    ">> 5. extend()\n",
    ">> 6. sort()\n",
    ">> ...\n",
    "> * list高级方法 如：\n",
    ">> 1.copy()  复制不等于赋值，复制可等价于 切片[:]\n",
    ">> 2.enu\n",
    "> * 课本练习（课堂上已完成）Don't panic ==> on tap 其中知识点:\n",
    ">> 1. list的一些方法实现\n",
    ">> 2. list的切片实现\n",
    ">> str => list 的方法  list（str）\n",
    ">> 4.list => str 的方法 ’’.join(list)\n",
    "\n",
    "## 本周内容\n",
    "#### 1、list练习\n",
    "#### 2、字典"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7fd22fc1",
   "metadata": {},
   "source": [
    "* 1. vowels2.py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3dc09647",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "i\n",
      "i\n",
      "a\n"
     ]
    }
   ],
   "source": [
    "vowels = ['a','e','i','o','u'] # 这是元音\n",
    "word = \"Milliways\" # 这是文本(str)\n",
    "# 需求：word中出现的 vowels 打印出来\n",
    "for i in word:   # in word => 循环的是word\n",
    "    if i in vowels:  # in vowels => 循环的是vowels\n",
    "        print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5fe1716e",
   "metadata": {},
   "source": [
    "##### 复习：for-in 循环专门用于遍历范围、列表、元素和字典等可迭代对象包含的元素。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "84593099",
   "metadata": {},
   "source": [
    "##### for-in循环的语法格式如下：\n",
    "###### for 变量 in 字符串丨范围丨集合等:\n",
    "######    Statements"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "7eac0aa7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['i', 'a']"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# append()经常用于新建列表\n",
    "found = []\n",
    "for i in word:\n",
    "    if i in vowels:\n",
    "        if i not in found:\n",
    "            found.append(i) # 把i增加进去\n",
    "found"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7353b63d",
   "metadata": {},
   "source": [
    "### 数据结构练习\n",
    "#### 购物车程序项目：\n",
    "#### 要求：\n",
    "##### input输入 转换成数字 for in循环   用户的余额减去商品金额"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1406ef34",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 准备工作\n",
    "# 1.商品信息\n",
    "goods_list =[[\"python课本\",60]，[\"华为手机\",8000]，\"小米电视-899\"，]\n",
    "# 2.用户购物信息\n",
    "user_shopping_list = [......]\n",
    "\n",
    "# 用户输入：商品编号数字？字符？\n",
    "# 1.输入的编号存在，判断余额是否足够\n",
    "### 1.余额足够 用户余额减商品价格\n",
    "### 2.余额不足，“您的余额不足”\n",
    "### \n",
    "# q.输入正确，打印商品列表\n",
    "# 2.输入错误，请输入正确的商品编号"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
